﻿import React, { Component } from 'react'
import PropTypes from 'prop-types'
import './common.css'

export default class Selectable extends Component {
    static propTypes = {
        text: PropTypes.string.isRequired,
        selected: PropTypes.bool,
        onSelect: PropTypes.func.isRequired
    }
    render() {
        var cn = `selectable-item ${this.props.selected === true ? 'item-selected' : ''}`;
        return <div className='hflex' onClick={this.props.onSelect} >
            <span className={cn}>{this.props.text}</span>
        </div>
    }
}